package com.example.demo.controller;

import com.example.demo.config.Rest;
import com.example.demo.domain.Menu;
import com.example.demo.service.MenuRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: renzh
 * @Description:
 * @Date: 18:22 2018-04-19
 * @Modified By:
 */
@RestController
@RequestMapping("menu")
public class MenuController {
    @Autowired
    private MenuRepository menuRepository;

    @Rest("addOrUpdate")
    public Menu addOrUpdateMenu(Menu menu){
        return menuRepository.saveAndFlush(menu);
    }
}
